package com.education.mapper;

import com.education.domain.Tbstudent;
import com.education.domain.TbstudentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbstudentMapper {
    @SelectProvider(type=TbstudentSqlProvider.class, method="countByExample")
    int countByExample(TbstudentExample example);

    @DeleteProvider(type=TbstudentSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbstudentExample example);

    @Delete({
        "delete from tbstudent",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbstudent (lStudentId, strStudentName, ",
        "nSex, dtBirthday, strMobile, ",
        "strAddress, lClassId, ",
        "nState, dtCreatTime, ",
        "dtModifyTime)",
        "values (#{lstudentid,jdbcType=INTEGER}, #{strstudentname,jdbcType=VARCHAR}, ",
        "#{nsex,jdbcType=INTEGER}, #{dtbirthday,jdbcType=DATE}, #{strmobile,jdbcType=VARCHAR}, ",
        "#{straddress,jdbcType=VARCHAR}, #{lclassid,jdbcType=INTEGER}, ",
        "#{nstate,jdbcType=INTEGER}, #{dtcreattime,jdbcType=TIMESTAMP}, ",
        "#{dtmodifytime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbstudent record);

    @InsertProvider(type=TbstudentSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbstudent record);

    @SelectProvider(type=TbstudentSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="lStudentId", property="lstudentid", jdbcType=JdbcType.INTEGER),
        @Result(column="strStudentName", property="strstudentname", jdbcType=JdbcType.VARCHAR),
        @Result(column="nSex", property="nsex", jdbcType=JdbcType.INTEGER),
        @Result(column="dtBirthday", property="dtbirthday", jdbcType=JdbcType.DATE),
        @Result(column="strMobile", property="strmobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="strAddress", property="straddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="nState", property="nstate", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Tbstudent> selectByExample(TbstudentExample example);

    @Select({
        "select",
        "lId, lStudentId, strStudentName, nSex, dtBirthday, strMobile, strAddress, lClassId, ",
        "nState, dtCreatTime, dtModifyTime",
        "from tbstudent",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="lStudentId", property="lstudentid", jdbcType=JdbcType.INTEGER),
        @Result(column="strStudentName", property="strstudentname", jdbcType=JdbcType.VARCHAR),
        @Result(column="nSex", property="nsex", jdbcType=JdbcType.INTEGER),
        @Result(column="dtBirthday", property="dtbirthday", jdbcType=JdbcType.DATE),
        @Result(column="strMobile", property="strmobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="strAddress", property="straddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="nState", property="nstate", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    Tbstudent selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbstudentSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbstudent record, @Param("example") TbstudentExample example);

    @UpdateProvider(type=TbstudentSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbstudent record, @Param("example") TbstudentExample example);

    @UpdateProvider(type=TbstudentSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbstudent record);

    @Update({
        "update tbstudent",
        "set lStudentId = #{lstudentid,jdbcType=INTEGER},",
          "strStudentName = #{strstudentname,jdbcType=VARCHAR},",
          "nSex = #{nsex,jdbcType=INTEGER},",
          "dtBirthday = #{dtbirthday,jdbcType=DATE},",
          "strMobile = #{strmobile,jdbcType=VARCHAR},",
          "strAddress = #{straddress,jdbcType=VARCHAR},",
          "lClassId = #{lclassid,jdbcType=INTEGER},",
          "nState = #{nstate,jdbcType=INTEGER},",
          "dtCreatTime = #{dtcreattime,jdbcType=TIMESTAMP},",
          "dtModifyTime = #{dtmodifytime,jdbcType=TIMESTAMP}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbstudent record);
}